home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / asm32.zip / E32.ZIP / PUSHPOP.ASM < prev    next >
Assembly Source File  |  1994-04-27  |  2KB  |  97 lines

  1. ; PUSHPOP.ASM for E32 - Copyright (C) 1994 Douglas Herr
  2. ;  all rights reserved
  3.  
  4. include    model.inc
  5.  
  6. public    pushpos, poppos, sub_push, add_push
  7. extrn    locate:near, rowcount:near
  8.  
  9. include    dataseg.inc
  10. extrn    rows:byte
  11. extrn    push_mode:byte
  12. extrn    cursor:dword
  13. extrn    push_offset:dword
  14. extrn    dirty_bits:byte
  15. extrn    file_row:dword
  16. extrn    count_start:dword
  17. count_bytes    equ    dword ptr count_start+4
  18. @curseg    ends
  19.  
  20. include    codeseg.inc
  21. pushpos    proc    near
  22.     mov    eax,cursor
  23.     mov    push_offset,eax
  24.     mov    push_mode,0FFh
  25.     ret
  26. pushpos    endp
  27.  
  28. poppos    proc    near
  29.     cmp    push_mode,0
  30.     je    short exit
  31.     xor    eax,eax
  32.     mov    count_start,eax
  33.     inc    eax
  34.     mov    file_row,eax
  35.     mov    eax,push_offset
  36.     mov    count_bytes,eax
  37.     mov    cursor,eax
  38.  
  39.     mov    dh,rows
  40.     shr    dh,1            ; move cursor to middle of screen
  41.     mov    esi,eax
  42.     call    locate            ; compute new top_of_screen
  43.     or    dirty_bits,00100001b    ; redraw top line & screen
  44.     call    rowcount
  45.  
  46. exit:    clc
  47.     ret
  48. poppos    endp
  49.  
  50. sub_push    proc    near
  51.     cmp    push_mode,0
  52.     je    short no_push
  53.     push    eax
  54.     push    ecx
  55.     mov    ecx,eax        ; bytes to be deleted
  56.     mov    eax,cursor
  57.  
  58. ; no action if position in file > push_offset
  59.     cmp    eax,push_offset
  60.     ja    short adjust_done
  61.  
  62. ; determine if saved position is to be deleted
  63. ; need push_offset > last character deleted
  64.     add    eax,ecx        ; EAX = offset of last char deleted
  65.     dec    eax
  66.     cmp    eax,push_offset
  67.     cmc
  68.     adc    push_mode,0    ; turn push_mode off
  69.     sub    push_offset,ecx
  70.  
  71. adjust_done:
  72.     pop    ecx
  73.     pop    eax
  74. no_push:
  75.     ret
  76. sub_push    endp
  77.  
  78. add_push    proc    near
  79.     cmp    push_mode,0
  80.     je    no_push
  81.     push    eax
  82.     push    ecx
  83.     mov    ecx,eax
  84.     mov    eax,cursor
  85.  
  86. ; no action if position in file > push_offset
  87.     cmp    eax,push_offset
  88.     ja    adjust_done
  89.  
  90.     add    push_offset,ecx
  91.     jmp    adjust_done
  92.  
  93. add_push    endp
  94.  
  95. @curseg    ends
  96.     end
  97.